package movie.serlvet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import movie.dao.MovieDao;
import movie.dao.impl.MovieDaoImpl;
import movie.entity.Movie;

public class MovieSaveServlet extends HttpServlet {


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String title = request.getParameter("name");
		String director = request.getParameter("director");
		String date = request.getParameter("date");
		MovieDao dao = new MovieDaoImpl();
		Movie movie = new Movie(0,title,director,date);
		if(dao.addMovie(movie)){
			System.out.println("ok");
		}
	}

}
